<template>
	<view>
		<view class="all">
			<u-form-item :label-position="labelPosition" label="原密码" label-width="150" prop="password">
				<u-input :password-icon="true" :border="border" type="text" v-model="passwords" placeholder="请输原密码">
				</u-input>
			</u-form-item>
			<u-form-item :label-position="labelPosition" label="新密码" label-width="150" prop="password">
				<u-input :border="border" type="password" v-model="password" placeholder="请输入新密码"></u-input>
			</u-form-item>
			<u-form-item :label-position="labelPosition" label="确认密码" label-width="150" prop="rePassword">
				<u-input :border="border" type="password" v-model="rePassword" placeholder="请确认密码"></u-input>
			</u-form-item>
		</view>
		<view class="button-bottom">
			<button class="btn btn-square btn-b" hover-class="btn-hover2" @click="submitHandler()"
				:disabled='submitStatus' :loading='submitStatus'>保存</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '我的',
				user: {},
				imgs: "",
				border: false,
				labelPosition: 'left',
				password: "",
				rePassword: "",
				passwords: "",
				submitStatus:false
			}
		},
		methods: {
			submitHandler() {
				this.submitStatus = true;
				this.$api.upPasswork({
					old_passwork: this.passwords,
					new_passwork: this.password
				}).then(res=>{
					this.$common.successToShow(res.data.msg, result => {
						this.submitStatus = false;
						if(res.data.msg=='操作成功'){
							uni.redirectTo({
							    url: '../personal'
							});
						}
					});
				})
			}
		}
	}
	
	
</script>

<style lang="less">
	.all {
		width: 100%;
		background: #F2F1F5;
		padding: 0 20rpx;
	}
</style>
